package com.jc.ds.model;

/**
 * role_permission
 * @author 
 */
public class RolePermission extends BaseValueObject {
    private Long id;

    private Long roleId;

    private Long permissionId;

    private String orderStr = null;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public Long getPermissionId() {
        return permissionId;
    }

    public void setPermissionId(Long permissionId) {
        this.permissionId = permissionId;
    }

    public void orderById(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by id asc";
            }else{
                this.orderStr = this.orderStr + ",id asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by id desc";
            }else{
                this.orderStr = this.orderStr + ",id desc";
            }
        }
    }

    public void orderByRoleId(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by role_id asc";
            }else{
                this.orderStr = this.orderStr + ",role_id asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by role_id desc";
            }else{
                this.orderStr = this.orderStr + ",role_id desc";
            }
        }
    }

    public void orderByPermissionId(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by permission_id asc";
            }else{
                this.orderStr = this.orderStr + ",permission_id asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by permission_id desc";
            }else{
                this.orderStr = this.orderStr + ",permission_id desc";
            }
        }
    }
}